home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 2001 May / SGI Freeware 2001 May - Disc 2.iso / dist / fw_libglade.idb / usr / freeware / include / glade / glade-build.h.z / glade-build.h
C/C++ Source or Header  |  2001-04-12  |  4KB  |  120 lines

  1. /* -*- Mode: C; c-basic-offset: 8 -*-
  2.  * libglade - a library for building interfaces from XML files at runtime
  3.  * Copyright (C) 1998-2001  James Henstridge <james@daa.com.au>
  4.  *
  5.  * glade-build.h: functions useful for adding support for new widgets.
  6.  *
  7.  * This library is free software; you can redistribute it and/or
  8.  * modify it under the terms of the GNU Library General Public
  9.  * License as published by the Free Software Foundation; either
  10.  * version 2 of the License, or (at your option) any later version.
  11.  *
  12.  * This library is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15.  * Library General Public License for more details.
  16.  *
  17.  * You should have received a copy of the GNU Library General Public
  18.  * License along with this library; if not, write to the 
  19.  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  20.  * Boston, MA  02111-1307, USA.
  21.  */
  22. #ifndef GLADE_BUILD_H
  23. #define GLADE_BUILD_H
  24.  
  25. #include <glade/glade-xml.h>
  26. #include <gtk/gtktypeutils.h>
  27. #include <gtk/gtkwidget.h>
  28. #include <gtk/gtkwindow.h>
  29. #include <gtk/gtkaccelgroup.h>
  30. #include <gtk/gtkadjustment.h>
  31.  
  32. #include <glade/glade-widget-tree.h>
  33.  
  34. #ifdef __cplusplus
  35. extern "C" {
  36. #endif /* __cplusplus */
  37.     
  38. /* create a new widget of some type.  Don't parse `standard' widget options */
  39. typedef GtkWidget *(* GladeNewFunc) (GladeXML *xml,
  40.                      GladeWidgetInfo *info);
  41. /* call glade_xml_build_widget on each child node, and pack in self */
  42. typedef void (* GladeBuildChildrenFunc) (GladeXML *xml,
  43.                      GtkWidget *w,
  44.                      GladeWidgetInfo *info,
  45.                      const char *longname);
  46.  
  47. typedef struct _GladeWidgetBuildData GladeWidgetBuildData;
  48. struct _GladeWidgetBuildData {
  49.   char *name;
  50.   GladeNewFunc new;
  51.   GladeBuildChildrenFunc build_children;
  52. };
  53.  
  54. /* widgets is a static, NULL terminated array of GladeWidgetBuildData's.
  55.  * They will be added to a hash table, with the name as the key, to be
  56.  * used by glade_xml_build_widget */
  57. void glade_register_widgets(const GladeWidgetBuildData *widgets);
  58.  
  59. /* set the current toplevel widget while building (use NULL to unset) */
  60. void glade_xml_set_toplevel(GladeXML *xml, GtkWindow *window);
  61.  
  62. /* push and pop accelerator groups on a stack */
  63. GtkAccelGroup *glade_xml_push_accel(GladeXML *xml);
  64. GtkAccelGroup *glade_xml_pop_accel(GladeXML *xml);
  65.  
  66. /* make sure that xml->priv->accel_group is a valid AccelGroup */
  67. GtkAccelGroup *glade_xml_ensure_accel(GladeXML *xml);
  68.  
  69. /* functions for manipulating the uline accel group stack */
  70. void           glade_xml_push_uline_accel(GladeXML *xml, GtkAccelGroup *uline);
  71. void           glade_xml_pop_uline_accel (GladeXML *xml);
  72. GtkAccelGroup *glade_xml_get_uline_accel (GladeXML *xml);
  73.  
  74. /* this is the handler for GtkLabel accelerators */
  75. void           glade_xml_handle_label_accel(GladeXML *xml, const gchar *target,
  76.                         guint key);
  77. guint          glade_xml_get_parent_accel  (GladeXML *xml);
  78.  
  79. /* set standard properties on a GtkWindow widget */
  80. void           glade_xml_set_window_props (GtkWindow *window,
  81.                        GladeWidgetInfo *info);
  82.  
  83. /* this function is called to build the interface by GladeXML */
  84. GtkWidget *glade_xml_build_widget(GladeXML *self, GladeWidgetInfo *info,
  85.                   const char *parent_long);
  86.  
  87. /* This function performs half of what glade_xml_build_widget does.  It is
  88.  * useful when the widget has already been created.  Usually it would not
  89.  * have any use at all. */
  90. void       glade_xml_set_common_params(GladeXML *self,
  91.                        GtkWidget *widget,
  92.                        GladeWidgetInfo *info,
  93.                        const char *parent_long);
  94.  
  95. /* A standard child building routine that can be used in widget builders */
  96. void glade_standard_build_children(GladeXML *self, GtkWidget *w,
  97.                    GladeWidgetInfo *info,const char *longname);
  98.  
  99. /* create an adjustment object for a widget */
  100. GtkAdjustment *glade_get_adjustment(GladeWidgetInfo *info);
  101.  
  102. /* this is a wrapper for gtk_type_enum_find_value, that just returns the
  103.  * integer value for the enum */
  104. gint glade_enum_from_string(GtkType type, const char *string);
  105.  
  106. /* a wrapper for gettext */
  107. char *glade_xml_gettext(GladeXML *xml, const char *msgid);
  108.  
  109. /* invoke the custom widget creation function */
  110. GtkWidget *glade_create_custom(GladeXML *xml, gchar *func_name, gchar *name,
  111.                    gchar *string1, gchar *string2,
  112.                    gint int1, gint int2);
  113.  
  114.  
  115. #ifdef __cplusplus
  116. }
  117. #endif /* __cplusplus */
  118.     
  119. #endif
  120.